﻿cmake_minimum_required(VERSION 3.5)

project(RX3D VERSION 0.1 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(ProgramName RX3D)
  
include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/../ReflectX
	${CMAKE_CURRENT_SOURCE_DIR}/../RXEntitySystem
	${Third_Eigen}/include
	${Third_BulletPhysics}/include
	${Third_GLEW}/include
	${Third_GLFW}/include
	${Third_GLM}/include
    )

set(RX3DCore
	RX3DCore/RX3DCoreAspect.cpp
	RX3DCore/RX3DCoreAspect.h
	RX3DCore/RX3DCoreService.cpp
	RX3DCore/RX3DCoreService.h
	RX3DCore/RX3DCoreTypes.cpp
	RX3DCore/RX3DCoreTypes.h
	RX3DCore/RXSceneComponent.cpp
	RX3DCore/RXSceneComponent.h
	RX3DCore/RXSceneShadowNode.cpp
	RX3DCore/RXSceneShadowNode.h
	RX3DCore/RX3DCore
	RX3DCore/RX3DCoreDef.h
)

set(RX3DPhysics
	RX3DPhysics/RXCollisionComponent.cpp
	RX3DPhysics/RXCollisionComponent.h
	RX3DPhysics/RXRigidBodyComponent.cpp
	RX3DPhysics/RXRigidBodyComponent.h
	RX3DPhysics/RXSensorBodyComponent.cpp
	RX3DPhysics/RXSensorBodyComponent.h
	RX3DPhysics/RX3DPhysicsService.h
	RX3DPhysics/RX3DPhysicsService.cpp
	RX3DPhysics/RX3DPhysicsAspect.h
	RX3DPhysics/RX3DPhysicsAspect.cpp
	RX3DPhysics/RX3DCollisionShadowNode.cpp
	RX3DPhysics/RX3DCollisionShadowNode.h
	RX3DPhysics/RX3DRigidShadowNode.cpp
	RX3DPhysics/RX3DRigidShadowNode.h
	RX3DPhysics/RX3DSensorShadowNode.h
	RX3DPhysics/RX3DSensorShadowNode.cpp
	RX3DPhysics/RX3DPhysics
	RX3DPhysics/RX3DPhysicsDef.h
)

set(RX3DRender
	RX3DRender/RX3DMeshComponent.cpp
	RX3DRender/RX3DMeshComponent.h
	RX3DRender/RX3DOutputInterface.cpp
	RX3DRender/RX3DOutputInterface.h
	RX3DRender/RX3DRenderAspect.cpp
	RX3DRender/RX3DRenderAspect.h
	RX3DRender/RX3DRenderService.cpp
	RX3DRender/RX3DRenderService.h
	RX3DRender/RX3DRendererComponent.h
	RX3DRender/RX3DRendererComponent.cpp
	RX3DRender/RX3DCameraComponent.cpp
	RX3DRender/RX3DCameraComponent.h
	RX3DRender/RX3DRender
	RX3DRender/RX3DRenderDef.h
	RX3DRender/RX3DMeshLoader.cpp
	RX3DRender/RX3DMeshLoader.h
	RX3DRender/RX3DRenderTypes.cpp
	RX3DRender/RX3DRenderTypes.h
	RX3DRender/RX3DShaderProgramAsset.cpp
	RX3DRender/RX3DShaderProgramAsset.h
	RX3DRender/RX3DMeshAsset.cpp
	RX3DRender/RX3DMeshAsset.h
	RX3DRender/RX3DRenderActorAsset.cpp
	RX3DRender/RX3DRenderActorAsset.h
	RX3DRender/RX3DTextureAsset.cpp
	RX3DRender/RX3DTextureAsset.h
	RX3DRender/RX3DMatrialAsset.cpp
	RX3DRender/RX3DMatrialAsset.h
	
	RX3DRender/ShadowNodes/RX3DMeshShadowNode.cpp
	RX3DRender/ShadowNodes/RX3DMeshShadowNode.h
	RX3DRender/ShadowNodes/RX3DCameraShadowNode.cpp
	RX3DRender/ShadowNodes/RX3DCameraShadowNode.h
	RX3DRender/ShadowNodes/RX3DRendererShadowNode.h
	RX3DRender/ShadowNodes/RX3DRendererShadowNode.cpp
	RX3DRender/ShadowNodes/RX3DRenderActorShadowNode.cpp
	RX3DRender/ShadowNodes/RX3DRenderActorShadowNode.h
	RX3DRender/ShadowNodes/RX3DShaderProgramShadowNode.cpp
	RX3DRender/ShadowNodes/RX3DShaderProgramShadowNode.h
	RX3DRender/ShadowNodes/RX3DTextureShadowNode.cpp
	RX3DRender/ShadowNodes/RX3DTextureShadowNode.h
	RX3DRender/ShadowNodes/RX3DMaterialShadowNode.cpp
	RX3DRender/ShadowNodes/RX3DMaterialShadowNode.h
	RX3DRender/ShadowNodes/RX3DMeshAssetShadowNode.cpp
	RX3DRender/ShadowNodes/RX3DMeshAssetShadowNode.h
	
	RX3DRender/Private/RX3DPainter.cpp
	RX3DRender/Private/RX3DPainter.h
	RX3DRender/Private/RX3DPainterData.cpp
	RX3DRender/Private/RX3DPainterData.h
)

SOURCE_GROUP("RX3DCore" FILES ${RX3DCore})
SOURCE_GROUP("RX3DPhysics" FILES ${RX3DPhysics})
SOURCE_GROUP("RX3DRender" FILES ${RX3DRender})

link_directories(
${Third_BulletPhysics}/lib
${Third_GLEW}/lib
${Third_GLFW}/lib
${Third_GLM}/lib
)

add_library(${ProgramName} SHARED
	RX3D_global.h
	${RX3DCore}
	${RX3DPhysics}
	${RX3DRender}
)

if(UNIX)
	set(LIB_PTHREAD -pthread)
endif()



set(BULLET_LINKS
	PRIVATE Bullet3Collision
	PRIVATE Bullet3Common
	PRIVATE Bullet3Dynamics
	PRIVATE Bullet3Geometry
	PRIVATE BulletCollision
	PRIVATE BulletDynamics
	PRIVATE BulletSoftBody
)

target_link_libraries(${ProgramName} 
PRIVATE ${LIB_PTHREAD} 
PRIVATE ReflectX 
PRIVATE RXEntitySystem
${BULLET_LINKS}		
PRIVATE OpenGL32
PRIVATE glew32
PRIVATE glfw3
)
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
target_compile_definitions(RX3D PRIVATE RX3D_LIBRARY)
